package com.surpassun.emall.repository;

import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.surpassun.emall.model.City;

@Repository
public class CityRepository extends AbstractRepository<City> {

	private final String QUERY_GET_POPULAR_Cities = "City_GetPopularCities";
	
	public CityRepository() {
		super(City.class);
	}

	@SuppressWarnings("unchecked")
	public List<City> getPopularCities(List<Long> referenceIds) {
		Query query = super.getEntityManager().createNamedQuery(QUERY_GET_POPULAR_Cities);
    	query.setParameter("referenceIds", referenceIds);
    	return (List<City>)query.getResultList();
	}
}
